import Vue from 'vue'
import Vuex from 'vuex'
import app from './modules/app'
import admin from './modules/admin'
import permission from './modules/permission'
import tag from './modules/tag'
import createLogger from 'vuex/dist/logger'
import order from './modules/order'
import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex)

const debug = process.env.NODE_ENV !== 'production'

export default new Vuex.Store({
  modules: {
    app,
    admin,
    tag,
    order,
    permission
  },
  strict: debug,
  plugins: debug ? [createLogger(), createPersistedState({
    paths: ['app'],
    storage: window.sessionStorage
  })] : [createPersistedState({
    paths: ['app'],
    storage: window.sessionStorage
  })]
})

